<template>
  <div class="headerNav">
    <div class="leftNav" v-show="isShow" :style="{ color }">
      <i class="iconfont icon-fanhuijiantou" @click="backPrevPage"></i>
      <i class="iconfont icon-vertical_line"></i>
      <i class="iconfont icon-shouye" @click="backHome"></i>
    </div>
    <div class="centerTitle">{{ title }}</div>
  </div>
</template>

<script>
export default {
  name: "HeaderNav",
  props: {
    isShow: {
      type: Boolean,
      default: false,
    },
    color: {
      type: String,
      default: "#000",
    },
    title: {
      type: String,
      default: "QQ音乐",
    },
  },
  methods: {
    backHome() {
      this.$router.push("/home");
    },
    backPrevPage() {
      this.$router.go(-1);
    },
  },
};
</script>

<style lang="scss" scoped>
.headerNav {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 4.5rem;
  .leftNav {
    position: absolute;
    left: 1rem;
    width: 5rem;
    height: 2rem;
    text-align: center;
    line-height: 1.9rem;
    border: 0.05rem solid #ccc;
    border-radius: 1rem;
    i {
      font-size: 1.25rem;
      font-weight: 700;
      cursor: pointer;
    }
    i.icon-vertical_line {
      color: #ccc;
    }
  }
  .centerTitle {
    height: 2rem;
    font-size: 1.5rem;
    color: #1a1a1a;
  }
}
</style>